package com.example.zyfyptlzx729.fragments;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.zyfyptlzx729.R;
import com.example.zyfyptlzx729.activities.LoginActivity;
import com.example.zyfyptlzx729.activities.MyCollectActivity;
import com.example.zyfyptlzx729.activities.MyFocusActivity;

public class Fragment5 extends BaseFragment {

    private LinearLayout linearLayout;
    private TextView textView;
    private Button btcollect, btfocus, btexit;

    public Fragment5(){}

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//        return super.onCreateView(inflater, container, savedInstanceState);
        return inflater.inflate(R.layout.fragment5,container,false);
    }
    

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        System.out.println("--f5--"+getSessionId());//父类

        initviews(view);
    }

    private void initviews(View view) {
        textView = view.findViewById(R.id.textView13);
        btcollect = view.findViewById(R.id.button6);
        btfocus = view.findViewById(R.id.button7);
        btexit = view.findViewById(R.id.button8);

        textView.setText("用户："+getUserName());

        btcollect.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), MyCollectActivity.class) ;
                startActivity(intent);
//                finish();
            }
        });

        btfocus.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), MyFocusActivity.class);
                startActivity(intent);
            }
        });

        btexit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), LoginActivity.class);
                startActivity(intent);
            }
        });
    }
}
